#!/bin/bash

step=2
SERVICE_NAME="nebula"
service_pid=`lsof -i:443 | awk '{print $2}'`

#echo "进程ID为：$service_pid"
for (( i = 0; i < 60; i=(i+step) )); do
	if [[ ! -n $service_pid ]]
	then
		echo "nebula fail"
		nohup /etc/nebula/nebula -config /etc/nebula/config.yaml 2>&1 &
		sleep 2
	else
		echo "nebula ok"
		sleep 1
	fi
done
exit 0